#region Apache License
//
// Licensed to the Apache Software Foundation (ASF) under one or more 
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership. 
// The ASF licenses this file to you under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with 
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#endregion

using System;
using System.Collections.Generic;
using System.Text;

namespace IPSim.Data
{
    /// <summary>
    /// Klasa koja reprezentuje UDP Packet.
    /// Sadrzi source i destination port.
    /// Enkapsulira aplikacioni podatak u sebi.
    /// </summary>
    public class UDPPacket : IIPData
    {

        private ushort m_srcPort;
        private IPAddress m_srcIPAddr;
        private ushort m_destPort;
        private IAppData m_data;

        public UDPPacket(ushort srcPort, ushort destPort, IAppData data)
        {
            m_srcPort = srcPort;
            m_destPort = destPort;
            m_data = data;
        }

        public UDPPacket(ushort srcPort, ushort destPort)
        {
            m_srcPort = srcPort;
            m_destPort = destPort;
        }


        public IAppData Data
        {
            get
            {
                return m_data;
            }
        }

        public ushort SrcPort
        {
            get
            {
                return m_srcPort;
            }
        }

        public ushort DestPort
        {
            get
            {
                return m_destPort;
            }
        }

        public IPAddress SenderIPAddress
        {
            get
            {
                return m_srcIPAddr;
            }
            set
            {
                m_srcIPAddr = value;
            }
        }

        public Type DeclaringType
        {
            get
            {
                return declaringType;
            }
        }

        private readonly static Type declaringType = typeof(UDPPacket);
    }
}
